{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{#
    {% set script_controller = 'trade/index' %}
#}

{% set menu = 'admin_' ~ targetType ~ '_order' %}

{% set script_controller = 'manage/list' %}

{% block main %}

  <form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    <div class="mbm">
    <div class="form-group">
      <label class="ptm" >创建时间:</label>
        <input class="form-control" type="text" id="startDate" name="startDateTime" value="{{request.get('startDateTime')}}" placeholder="起始时间">
        -
        <input class="form-control" type="text" id="endDate" name="endDateTime" value="{{request.get('endDateTime')}}" placeholder="结束时间">
    </div>
    </div>
    <div class="mbm">
    <div class="form-group">
      <label class="ptm" >筛选条件:</label>
        <select class="form-control" name="status">
          {{ select_options(dict('orderStatus'), request.get('status'), '订单状态') }}
        </select>
  
      <select class="form-control" name="payment">
        {{ select_options(dict('payment'), request.get('payment'), '支付方式') }}
      </select>
    </div> 
    <div class="form-group" style="display:none;">
      <input class="form-control" type="text" name="paidTimeRange", placeholder="付款时间段">
    </div>


    <div class="form-group">
    <label class="ptm" >关键词:</label>
      <select class="form-control" name="keywordType">
        {% set options = {sn: '订单号', buyer:'购买者用户名', targetId: dict_text('targetName', targetType) ~ '编号', title: dict_text('targetName', targetType) ~ '名'} %}
        {{ select_options(options, request.get('keywordType')) }}
      </select>

    <input class="form-control" type="text" name="keyword" value="{{ request.get('keyword') }}" placeholder="关键词">
    </div>

    <button class="btn btn-primary">搜索</button>
    <a class="btn btn-primary" href="{{ path('admin_order_manage_export_csv',
    {targetType:targetType,
    startTime:request.get('startDateTime'),
    endTime:request.get('endDateTime'),
    status:request.get('status'),
    payment:request.get('payment'),
    keywordType:request.get('keywordType'),
    keyword:request.get('keyword')
    })}}">导出结果</a>
    </div>
  </form>

  <table class="table table-striped table-hover" id="order-table">
    {% include 'TopxiaWebBundle:Order:order-table.html.twig' with {mode:'admin'} %}
  </table>

  <div class="paginator">
    {{ web_macro.paginator(paginator) }} 
  </div>


{% endblock %}
